package com.example.a517;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class PendingIntentActivity extends AppCompatActivity implements View.OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_pending_intent);


    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.send_notification){
            Intent intent = new Intent(this,NotificationActivity.class);
            PendingIntent pi = PendingIntent.getActivity(this,0,intent,0);
            NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
            Notification notification = new NotificationCompat.Builder(this,"ll")
                    .setContentTitle("this is a title")
                    .setContentText("this is content")
                    .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.mipmap.aa))
                    .build();
            manager.notify(1,notification);
        }
    }
}